package com.gopay.solution.service.decision;

import com.gopay.common.domain.BaseEntity;
import com.gopay.solution.domain.bo.SolutionRuleExecutor;
import com.gopay.solution.domain.vo.Event;
import com.gopay.solution.domain.vo.Result;
import com.gopay.solution.domain.vo.Solution;

/**
 * 方案决策
 * 
 * @Decision.java
 * @author MA HUAN
 * @2013-3-25 下午4:12:05 www.gopay.com.cn Inc.All rights reserved.
 */
public class Decision extends BaseEntity {

    private static final long serialVersionUID = -2844657949428260977L;

    private boolean isMade;
    private String failedReason;

    private String acctId;
    private String solutionType;

    private Event event;
    private Solution solution;
    private SolutionRuleExecutor ruleExecutor;

    public Decision(boolean isMade, String failedReason, String acctId, String solutionType, Event event,
            Solution solution, SolutionRuleExecutor ruleExecutor) {
        super();
        this.isMade = isMade;
        this.failedReason = failedReason;
        this.acctId = acctId;
        this.solutionType = solutionType;
        this.event = event;
        this.solution = solution;
        this.ruleExecutor = ruleExecutor;
    }

    /**
     * 执行决策
     * 
     * @return 决策实行结果
     */
    public Result execute() {

        return ruleExecutor.execute(solution.getRuleDtls(), event);
    }

    /**
     * 输出决策信息
     * 
     * @return 决策信息
     */
    public String show() {
        return null;
    }

    public boolean isMade() {
        return isMade;
    }

    public String getFailedReason() {
        return failedReason;
    }

    public String getAcctId() {
        return acctId;
    }

    public String getSolutionType() {
        return solutionType;
    }

    public Event getEvent() {
        return event;
    }

    public Solution getSolution() {
        return solution;
    }

    public SolutionRuleExecutor getRuleExecutor() {
        return ruleExecutor;
    }

}
